﻿#ifndef OBEJCTMANAGER_H
#define OBEJCTMANAGER_H
#include "memory_pool.h"
namespace RemoteObj
{
template<typename T>
class ObjectManager
{
public:
    typedef T ObjectType;

    static ObjectType* Create(MemoryPool& pool)
    {
        void* object = pool.malloc(sizeof(T));
        new(object) ObjectType();
        return static_cast<ObjectType*>(object);
    }
    static void Delete(MemoryPool& pool, ObjectType* object)
    {
        object->~ObjectType();
        pool.free(object);
    }
};

}

#endif // OBEJCTMANAGER_H
